X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=blobdiff_plain;f=tests%2Fparser%2FParserTestRunner.php;h=04c142ab77bb7534bb78fea0dae55900a34773c9;hb=37751ee23e7b7019307eafe36f18c8450bf2e420;hp=e433c2ed9aefc85270a84760d28917af68e607e7;hpb=d571769c9550d689959bc196ea6f0c31e5770ef6;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/parser/ParserTestRunner.php b/tests/parser/ParserTestRunner.php index e433c2ed9a..04c142ab77 100644 --- a/tests/parser/ParserTestRunner.php +++ b/tests/parser/ParserTestRunner.php @@ -426,7 +426,7 @@ class ParserTestRunner { * @param ScopedCallback|null A ScopedCallback to consume * @return ScopedCallback */ - protected function createTeardownObject( $teardown, $nextTeardown ) { + protected function createTeardownObject( $teardown, $nextTeardown = null ) { return new ScopedCallback( function() use ( $teardown, $nextTeardown ) { // Schedule teardown snippets in reverse order $teardown = array_reverse( $teardown ); @@ -1503,7 +1503,14 @@ class ParserTestRunner { throw new MWException( "duplicate article '$name' at $file:$line\n" ); } + // Use mock parser, to make debugging of actual parser tests simpler. + // But initialise the MessageCache clone first, don't let MessageCache + // get a reference to the mock object. + MessageCache::singleton()->getParser(); + $restore = $this->executeSetupSnippets( [ 'wgParser' => new ParserTestMockParser ] ); $status = $page->doEditContent( ContentHandler::makeContent( $text, $title ), '', EDIT_NEW ); + $restore(); + if ( !$status->isOK() ) { throw new MWException( $status->getWikiText( false, false, 'en' ) ); }